package com.everyday.practice.algorithm;

/**
 * @description: 将有序数组转换为二叉搜索树
 * @author: leon
 * @time: 2021/3/30 16:36
 */
public class Title108 {

    public static void main(String[] args) {
        int i=100010000;
        Integer n=Integer.bitCount(i);
        System.out.println(n);
    }

    public TreeNode sortedArrayToBST(int[] nums) {
        return null;
    }

    //中序法
    public TreeNode dfs(int[] nums,int lo,int li){
        if (lo>li){
            return null;
        }
        int mid=lo+(li-lo)/2;  //防止值过大 超过integer上限
        TreeNode root=new TreeNode(nums[mid]);
        root.left=dfs(nums,lo,mid-1);
        root.right=dfs(nums,mid+1,li);
        return root;
    }

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;

        TreeNode() {
        }

        TreeNode(int val) {
            this.val = val;
        }

        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }
}
